package com.ahcfl.dao;

import com.ahcfl.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {

    @Select("select stu_name from student")
    public List<String> findAllStudentNames();

    @Insert("insert into student(id,stu_name) values(null,#{stuName})")
    public void addStudent(@Param("stuName") String stuName);


    @SelectProvider(type = StudentSqlProvider.class,method = "findAllStudentsCount")
    public int findAllStudentsCount(@Param("name") String name);


    @SelectProvider(type = StudentSqlProvider.class,method = "findAllStudents")
    public List<Student> findAllStudents(@Param("start") int start,
                                         @Param("pageSize") int pageSize,
                                         @Param("name") String name);

    @Update("update student set stu_score=#{score} where id=#{id}")
    public void updateStudentScoreById(@Param("id") int id, @Param("score") int score);
}
